<?php
/**
 * Argument page tabs markup helper.
 *
 * @category Zend
 * @package Helper
 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc.
 * @version $Id$
 * @link http://framework.zend.com
 * @since Available since release 1.0
 * @license GPL v3
 */

class Zend_View_Helper_DisputeTabsHelper extends Zend_View_Helper_Abstract
{
    /**
     * Zend_View_Interface
     */
    protected $_view;
    
    /**
     * Automatically sets view property when loaded
     * 
     * @param Zend_View_Interface $view 
     */
    public function setView(Zend_View_Interface $view)
    {
        $this->_view = $view;
    }
    
    /**
     * Returns dispute/argument page tabs HTML
     * 
     * @return string
     */
    public function disputeTabsHelper()
    {   
        $tabs = array(
            '#argument' => 'Argument',
            '#comment' => 'Comments (0)'
        );
        
        $this->_view->hideForm = false;
        if (! $this->_view->session->username) {
            $tabs['/user/login'] = 'Contest';
        }
        elseif ($this->_view->session->userId != $this->_view->dispute->userId) {
            $tabs['#contest'] = 'Contest';
        } else {
            $this->_view->hideForm = true;
        }
        
        return $this->_view->partial('partials/tabs.phtml', array(
            'tabs' => $tabs,
            'active' => '#' . $this->_view->active
        ));
    }
}
